import { get, postJson} from './api'
import qs from 'qs'

// 获取客户列表
export const getClients = (args = {}) => {
    const url = '/usermgt/employee';
    const body = {
        method: 'getCustomers',
        args: JSON.stringify(args)
    };
    return postJson(url, body)
};

// 新增客户
export const addCustomer = (args = {}) => {
    const url = '/usermgt/employee/form';
    const body = {
        method: 'addCustomer',
        args: JSON.stringify(args)
    }
    return postJson(url, qs.stringify(body), {headers: {'Content-Type': 'application/x-www-form-urlencoded'}})
};

//禁止用户和编辑用户
export const operateCustomer = (args = {}) => {
    const url = '/usermgt/employee/form';
    const body = {
        method: 'updateCustomer',
        args: JSON.stringify(args)
    }
    return postJson(url, qs.stringify(body), {headers: {'Content-Type': 'application/x-www-form-urlencoded'}})
};

// 获取单个客户详情
export const getCustormer = (arg) => {
    const url = `/usermgt/employee/${arg}`;
    return get(url)
};

// 获取客户编号
export const getCustomerNo = () => {
    const url = '/usermgt/employee';
    const body = {
        method: 'getCustomerNo'
    }
    return postJson(url, body)
};

//